<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        span {
            display: inline-block;
            width: 100px;
            height: 24px;
            margin: 0.5px;
            border: 1px solid black;
            text-align: center;
            line-height: 24px;
        }
       
    </style>
</head>
<body>
    <script>
        // 5.打印100以内跟7相关的数字，打印100以内过滤掉7的倍数的其他数字；
        document.write("打印100以内跟7相关的数字：<br>");
        for (let i = 1; i <= 100; i++) {
            if (i % 7 === 0 || i % 10 === 7 || parseInt(i / 10) === 7) {
                document.write(i + "&nbsp;");
            }
        }
        document.write("<br>打印100以内过滤掉7的倍数的其他数字：<br>");
        for (let i = 1; i <= 100; i++) {
            if (i % 7 !== 0) {
                document.write(i + "&nbsp;");
            }
        }
        document.write("<hr>");

        // 6.计算target多少年后存款能翻倍 初始值1000元，利率0.05
        for (let year = 0 , money = 1000; money <= 2000;) {
            year++;
            money *= (1 + 0.05);
            document.write("第" + year + "年后，存款：" + money.toFixed(2) + "元<br>");
        }
        document.write("<hr>");

        // 7.打印5*6矩形
        for (let i = 1 ; i <= 5; i++) {
            for (let j = 1; j <= 6; j++) {
                document.write("*");
            }
            document.write("<br>");
        }
        document.write("<hr>");

        // 8.打印直角三角形
        for (let i = 1; i <= 5; i++) {
            for (let j = 1; j <= i; j++) {
                document.write("*");
            }
            document.write("<br>");
        }
        document.write("<hr>");

        // 9.打印等腰三角形
        for (let i = 1 , l = 1; i <= 5; i++ , l += 2) {
            for (let j = 1; j <= (9 - 1 * l) / 2 ; j++) {
                document.write("&nbsp;&nbsp;");
            }
            for (let k = 1; k <= 1 * l; k++) {
                document.write("*");
            }
            document.write("<br>");
        }
        document.write("<hr>");

        // 10.打印99乘法表
        for (let a = 1 ; a <= 9 ; a++) {
            for (let b = 1 ; b <= a ; b++) {
                document.write(`<span>${b} x ${a} = ${a*b}</span>`)
            }
            document.write("<br>");
        }
        document.write("<hr>");

        // 11.练习：100元买100只鸡 假设1元买3只小鸡，5元买1只公鸡，3元买1只母鸡
        // x = 公鸡
        // y = 母鸡
        // z = 小鸡
        let sum = 0;
        for (let z = 0 ; z <= 100; z++){
            for (let y = 0 ; y <= 33; y++) {
                for (let x = 0 ; x <= 20; x++) {
                    if (x + y + z === 100 && 5 * x + 3 * y + 1/3 * z === 100) {
                        document.write(`公鸡${x} 母鸡${y} 小鸡${z}<br>`);
                    }
                    sum += 1;
                }
            }
        }
        document.write(`${sum}`);
        document.write("<hr>");
        

       
    </script>
</body>
</html>